import jsonp from 'common/js/jsonp'
import {commonParams, options} from './config'
import axios from 'axios'

export function getRecommend() {// 利用jsonp抓取数据
  const url = 'https://c.y.qq.com/musichall/fcgi-bin/fcg_yqqhomepagerecommend.fcg'

  const data = Object.assign({}, commonParams, {
    platform: 'h5',
    uin: 0,
    needNewCode: 1
  })

  return jsonp(url, data, options)
}


export function getPlaylist(){
	const url = '/api/getPlaylist'

	 const data = Object.assign({}, commonParams, {
    platform: 'yqq',
    hostUin: 0,
    sortId:5,
    sin:0,
    ein:29,
    categoryId:10000000,
    needNewCode: 1,
    rnd:Math.random(),
     format: 'json'
  })

	return axios.get(url, {
		params: data
	}).then( (res) => {
		return Promise.resolve(res.data)
	})
}
